package com.ktgj.flight.service.impl;

import java.util.List;
import com.ktgj.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ktgj.flight.mapper.TerminalMapper;
import com.ktgj.flight.domain.Terminal;
import com.ktgj.flight.service.ITerminalService;

/**
 * 航站楼Service业务层处理
 * 
 * @author ruoyi
 * @date 2022-06-01
 */
@Service
public class TerminalServiceImpl implements ITerminalService 
{
    @Autowired
    private TerminalMapper terminalMapper;

    /**
     * 查询航站楼
     * 
     * @param terminalId 航站楼ID
     * @return 航站楼
     */
    @Override
    public Terminal selectTerminalById(Long terminalId)
    {
        return terminalMapper.selectTerminalById(terminalId);
    }

    /**
     * 查询航站楼列表
     * 
     * @param terminal 航站楼
     * @return 航站楼
     */
    @Override
    public List<Terminal> selectTerminalList(Terminal terminal)
    {
        if (terminal.getCreateEndDate() != null && !terminal.getCreateEndDate().equals(""))
            terminal.setCreateEndDate(terminal.getCreateEndDate() + " 23:59:59");
        return terminalMapper.selectTerminalList(terminal);
    }

    /**
     * 新增航站楼
     * 
     * @param terminal 航站楼
     * @return 结果
     */
    @Override
    public int insertTerminal(Terminal terminal)
    {
        terminal.setCreateTime(DateUtils.getNowDate());
        return terminalMapper.insertTerminal(terminal);
    }

    /**
     * 修改航站楼
     * 
     * @param terminal 航站楼
     * @return 结果
     */
    @Override
    public int updateTerminal(Terminal terminal)
    {
        return terminalMapper.updateTerminal(terminal);
    }

    /**
     * 批量删除航站楼
     * 
     * @param terminalIds 需要删除的航站楼ID
     * @return 结果
     */
    @Override
    public int deleteTerminalByIds(Long[] terminalIds)
    {
        return terminalMapper.deleteTerminalByIds(terminalIds);
    }

    /**
     * 删除航站楼信息
     * 
     * @param terminalId 航站楼ID
     * @return 结果
     */
    @Override
    public int deleteTerminalById(Long terminalId)
    {
        return terminalMapper.deleteTerminalById(terminalId);
    }
}
